<template>
  <h3>自动推导</h3>
  <p>computedList: {{ computedList }}</p>
  <h3>显式注解</h3>
  <p>computedStrList: {{ computedStrList }}</p>
</template>

<script setup lang="ts">
import { ref, computed } from 'vue'
defineOptions({ name: 'PageComputed' })
const list = ref([1, 2, 3, 4, 5])

const computedList = computed(() => list.value.filter((item) => item > 2))
// computedList 推导出来的为 ComputedRef<number[]>
// 显式注解
const listNumber = ref([1, 2, 3, 4, 5])
const computedStrList = computed<number[]>(() => listNumber.value.filter((item) => item > 3))
</script>

<style scoped lang="scss"></style>
